<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let newsData = [
        { id: 10001, title: "新闻一", isHot: true, content: "内容一积极响应" },
        { id: 10002, title: "新闻二", isHot: false, content: "内容二" },
        { id: 10003, title: "新闻三", isHot: true, content: "内容三" },
        { id: 10004, title: "新闻四", isHot: false, content: "内容四" },
        { id: 10005, title: "新闻五", isHot: true, content: "内容五" },
      ];
      let arr1 = [];
      for (let i = 0; i < newsData.length; i++) {
        if (newsData[i].isHot === false) {
          console.log(newsData[i].title);
        }
        if (newsData[i].id === 10004) {
          //   let value = i;
          console.log(i);
        }
        if (newsData[i].id === 10003) {
          newsData[i].title = "新闻五";
          console.log(`这是${newsData[i].title}`);
        }
        if (newsData[i].isHot === true) {
          arr1.push(newsData[i]);
        }
        if (newsData[i].isHot === true && newsData[i].content.length > 5) {
          console.log(newsData[i]);
        }
        console.log(
          `${newsData[i].title}新闻的信息是: id为${newsData[i].id},该新闻${newsData[i].isHot}热点
          内容是${newsData[i].content}
          `
        );
      }
      console.log(arr1);
    </script>
  </body>
</html>
